<legend>Configuracion >> Tasas</legend>
<form id="form_formula" class="well well-small span9" method="POST" >
    <div class="row">
        <div class="span3">
            <div class="control-group" style="display: inline-block;">
                <label class="control-label" for="inputTipoDoc">Fórmula</label>
                <div class="controls">
                    <select id="formula" name="formula" class="input-xlarge" onchange="document.getElementById('form_formula').submit();">
                        <option value="0">Seleccione fórmula</option>
                        <?php foreach ($this->formulas as $formula) { ?>
                            <option <?php echo $this->formula_id == $formula->getId() ? "selected" : "" ?> value="<?php echo $formula->getId(); ?>">
                                <?php echo $formula->getDescripcion(); ?></option>
                        <?php } ?>
                    </select>
                </div>
            </div>
        </div>
        <div class="span3">
            <?php if ($this->messages) : ?>
            <div class="alert alert-success">
                <?php echo $this->messages[0]; ?>
            </div>
            <?php endif; ?>
        </div>
    </div>
</form>
<?php if ($this->formula) : ?>
<form class="well well-small span9" method="POST" action="<?php echo $this->baseUrl("/admin/configuracion/tasa/") ?>">
    <input id="formula_id" name="formula_id" type="hidden" value="<?php echo $this->formula_id ?>" class="input-small" style="text-align:right;" />
    <legend><?php echo $this->titulo ?></legend>
    <?php $i = 1; ?>
    <?php $tasas = $this->formula->getTasasPorSucursal($this->usuario->getSucursal()->getId()); ?>
    <?php foreach ($tasas as $tasa) : ?>
        <?php if ($tasa->getActivo()) : ?>
            <div class="row-fluid">
                <div class="span1" style="text-align:right;">
                    <h4><?php echo $i ?>)</h4>
                </div>
                <div class="span2">
                    <div class="control-group" style="display: inline-block;">
                        <label class="control-label" for="inputTipoDoc">Tasa</label>
                        <div class="controls">
                            <div class="input-append">
                                <input id="tasa_<?php echo $i ?>" name="tasa_<?php echo $i ?>" type="text" value="<?php echo $tasa->getValor() ?>" class="input-small" style="text-align:right;" />
                                <span class="add-on">%</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="span3">
                    <div class="control-group" style="display: inline-block;">
                        <label class="control-label" for="inputTipoDoc">Cuotas</label>
                        <div class="controls">
                            <input id="cuota_desde_<?php echo $i ?>" name="cuota_desde_<?php echo $i ?>" type="text" value="<?php echo $tasa->getDesde() ?>" class="input-mini" style="text-align:right;"/> 
                            <b>...</b>
                            <input id="cuota_hasta_<?php echo $i ?>" name="cuota_hasta_<?php echo $i ?>" type="text" value="<?php echo $tasa->getHasta() ?>" class="input-mini" style="text-align:right;"/>
                        </div>
                    </div>
                </div>
            </div>
        <?php $i += 1; ?>
        <?php endif; ?>
    <?php endforeach; ?>
    <!-- Tasa Vacias -->
    <?php for ($j = $i; $j < 13; $j++) : ?>
        <div class="row-fluid">
                <div class="span1" style="text-align:right;">
                    <h4><?php echo $j ?>)</h4>
                </div>
                <div class="span2">
                    <div class="control-group" style="display: inline-block;">
                        <label class="control-label" for="inputTipoDoc">Tasa</label>
                        <div class="controls">
                            <div class="input-append">
                                <input id="tasa_<?php echo $j ?>" name="tasa_<?php echo $j ?>" type="text" value="" class="input-small" style="text-align:right;" />
                                <span class="add-on">%</span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="span3">
                    <div class="control-group" style="display: inline-block;">
                        <label class="control-label" for="inputTipoDoc">Cuotas</label>
                        <div class="controls">
                            <input id="cuota_desde_<?php echo $j ?>" name="cuota_desde_<?php echo $j ?>" type="text" value="" class="input-mini" style="text-align:right;"/> 
                            <b>...</b>
                            <input id="cuota_hasta_<?php echo $j ?>" name="cuota_hasta_<?php echo $j ?>" type="text" value="" class="input-mini" style="text-align:right;"/>
                        </div>
                    </div>
                </div>
            </div>
    <?php endfor; ?>
    <div class="form-actions">
        <button name="form_tasa" type="submit" class="btn btn-primary">Guardar</button>
    </div>
</form>
<?php endif; ?>